
<script>
	import { http } from '@/common/service.js' // 全局挂载引入，配置相关在该index.js文件里修改
	export default {
		onLaunch: function() {
			console.log('App Launch');
			try{
				// #ifdef H5
					getApp().globalData.ticket = uni.getStorageSync('token');
					getApp().globalData.user = uni.getStorageSync('user');
					getApp().globalData.session = uni.getStorageSync('session')
				// #endif
				
				// #ifdef MP
					this.$scope.globalData.ticket = uni.getStorageSync('token');
					this.$scope.globalData.user = uni.getStorageSync('user');
					this.$scope.globalData.session = uni.getStorageSync('session')
				// #endif
			}catch(err){
				console.log(err);
				uni.clearStorage();
			}
		},
		onShow: function(options) {
			console.log('App Show');
			// #ifdef H5
				http.setConfig((config) => {
					config.header = {
						channel: getApp().globalData.channel
					}
					return config
				})
			// #endif
			
			// #ifdef MP
				http.setConfig((config) => {
					config.header = {
						channel: this.$scope.globalData.channel
					}
					return config
				})
			// #endif

		},
		onHide: function() {
			console.log('App Hide');
		},

		globalData: {
			appid: 'wx6d897a71f2f75579',
			appName: '金职成长测评系统',
			theme: 'msdd',
			themeColor: '#ABD1F5',
			channel: 'msdd',
			session:{},
			user:{},
			ticket:'',
		},
	};
</script>

<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
	
	/* 解决头条小程序组件内引入字体不生效的问题 */
	/* #ifdef MP-TOUTIAO */
	@font-face {
		font-family: uniicons;
		src: url('/static/uni.ttf');
	}

	/* #endif */
	
	
	.line{
		height:1px;
		background-color: rgba(230,230,230,1);
		opacity:1;
	}
	
	.ling-view{
		background-color: #F7F7F7;
		height: 20rpx;
		/* margin-bottom: 40rpx; */
	}
	
	.safe-area-view{
		height: constant(safe-area-inset-bottom);
		height: env(safe-area-inset-bottom);
		width: 100%;
		/* background-color: #4CD964; */
	}
</style>
